/* See LICENSE for copyright and terms of use */

/**
 * Minimalist implementation of a set.
 * @author Tay Ray Chuan
 */

class org.evtmng.util.Set {
	private var m_items:Array;

	public function Set() {
		m_items = [];
	}

	public function addItem(item:Object):Void {
		for(var i:String in m_items) {
			if(m_items[i]==item) {
				return;
			}
		}
		m_items.push(item);
	}

	public function removeItem(item:Object):Void {
		for (var i:Number = 0; i < m_items.length; i++) {
			m_items.splice(i, 1);
		}
	}

	public function hasItem(item:Object):Boolean {
		for (var i:String in m_items) {
			if(m_items[i] == item) {
				return true;
			}
		}
		return false;
	}

	public function internalList():Array {
		return m_items;
	}
}